from inspect import isfunction
class MyClass:
    attr1 = 111
    __attr2 = 222
    attr3 = attr1 + __attr2
    def showAttrs(self):
#object.__dict__一般是字典或其他映射对象，用来存储一个对象（可写的）属性。
        for x in self.__class__.__dict__.items():
            if isfunction(x[1]):
                print("成员方法：{0}".format(x[0]))
            elif type(x[1]) == int:
                if x[0].find("_MyClass") == -1:
                    print("公有属性：{0}；值：{1}".format(x[0], x[1]))
                else:
                    print("私有属性：{0}；值：{1}".format(x[0], x[1]))

if __name__ == '__main__':
    MyClass().showAttrs()
    print("-"*60)
    MyClass.attr1 = 555
    MyClass._MyClass_attr2 = 777
    MyClass.attr4 = 666
    MyClass.attr5 = 999
    MyClass().showAttrs()